#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool isRepeatedSubstring(const char *str)
{
    int len = strlen(str);
    for (int i = 1; i <= len / 2; i++)
    {
        if (len % i == 0)
        {
            int repeatCount = len / i; 
            char subStr[i + 1];        
            strncpy(subStr, str, i);   
            subStr[i] = '\0';          

            char repeated[len + 1]; 
            repeated[0] = '\0';     

            for (int j = 0; j < repeatCount; j++)
            {
                strcat(repeated, subStr); 
            }

            if (strcmp(repeated, str) == 0)
            {
                return true; 
            }
        }
    }

    return false;
}

int main()
{
    char str[20] = "abcabcabc";
    if (isRepeatedSubstring(str))
    {
        printf("true\n");
    }
    else
    {
        printf("false\n");
    }

    return 0;
}